#include "Circle.h"

Circle::Circle(){
	Circle(4, 4, 2);
}
Circle::Circle(unsigned int x, unsigned int y, unsigned int diameter){
	SetX(x);
	SetY(y);
	SetDiameter(diameter);
}
Circle::~Circle(){
	
}

void Circle::SetDiameter(unsigned int diameter){
	this->diameter = diameter;
	radius = diameter/2;
}
unsigned int Circle::GetDiameter(){
	return diameter;
}
void Circle::SetRadius(unsigned int radius){
	this->radius = radius;
	diameter = radius*2;
}
unsigned int Circle::GetRadius(){
	return radius;
}
bool Circle::AreCoordinatesWithinShape(unsigned int x, unsigned int y){
	return false;
}
bool Circle::IsCircleWithin(Circle* circle){
	return false;
}
bool Circle::AreCirclesIntersecting(Circle* c1, Circle* c2){
	//dx=ax-bx
	int dx = c1->GetX() - c2->GetX();

	//dy=ay-by
	int dy = c1->GetY() - c2->GetY();

	//r=ar+br
	unsigned int r = c1->GetRadius() + c2->GetRadius();

	//collision=r*r>dx*dx+dy*dy
	if(r * r > dx * dx + dy * dy)
		return true;
	else
		return false;
}
void Circle::BlitShape(){
    LibraryInterface::DrawFilledCircle(x,y,radius, 127, 255, 0);
}